package com.bkgy.controller.stripsteel.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bkgy.commom.model.QueryDTO;
import com.bkgy.controller.stripsteel.domain.TbPaopianPdoData;
import com.bkgy.controller.stripsteel.domain.dto.StripSteelDto;
import com.bkgy.controller.stripsteel.service.StripSteelService;
import com.bkgy.sys.common.entity.ResultData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * 带钢信息
 */
@Tag(name = "1630连退跑偏生产实际", description = "1630连退跑偏生产实际")
@RestController
@RequestMapping("/strip")
public class StripSteelController {

    @Autowired
    private StripSteelService stripSteelService;

    @Operation(summary = "带钢分页查", description = "根据条件分页查询带钢信息")
    @PostMapping("/findByPage")
    public ResultData<Page<TbPaopianPdoData>> findStripSteelByPage(@RequestBody @Valid QueryDTO<StripSteelDto> queryDTO) {
        return stripSteelService.findStripSteelByPage(queryDTO);
    }

    @Operation(summary = "生产实际跑偏列表导出", description = "生产实际跑偏列表导出")
    @PostMapping("/exportXlsx")
    public void exportXlsx(@RequestBody @Valid QueryDTO<StripSteelDto> queryDTO, HttpServletResponse response) {
        stripSteelService.aosrpeExcel(queryDTO, response);
    }

    @Operation(summary = "产品成材率全流程分析", description = "产品成材率全流程分析")
    @PostMapping("/getSteelInfo")
    public ResultData getSteelInfo(@RequestBody @Valid List<String> coilIds) {
        return stripSteelService.getSteelInfo(coilIds);
    }
}
